package mdm.led.service.impl;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import mdm.led.dao.SysLogMapper;
import mdm.led.entity.SysLog;
import mdm.led.service.ILogService;
import mdm.led.util.DateUtil;

import java.util.List;

@Service("iLogService")
public class LogServiceImpl implements ILogService {
    private final SysLogMapper sysLogMapper;

    @Autowired
    public LogServiceImpl(SysLogMapper sysLogMapper) {
        this.sysLogMapper = sysLogMapper;
    }

    @Override
    public List<SysLog> selectByCondition(SysLog sysLog) throws Exception {
        if (StringUtils.isNotEmpty(sysLog.getEndDate())) {
            sysLog.setEndDate(DateUtil.addDate(sysLog.getEndDate(), 1));
        }
        return sysLogMapper.selectByCondition(sysLog);
    }
}
